package com.example.mypplication.aicoze

import android.os.Bundle
import androidx.activity.enableEdgeToEdge
import androidx.appcompat.app.AppCompatActivity
import androidx.core.view.ViewCompat
import androidx.core.view.WindowInsetsCompat
import com.example.mypplication.R
import com.example.mypplication.databinding.ActivityAartestBinding
import com.example.mypplication.databinding.ActivityFlexboxExpandBinding

class CozeAiActivity : AppCompatActivity() {
    private lateinit var binding: ActivityAartestBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        binding = ActivityAartestBinding.inflate(layoutInflater)
        setContentView(binding.root)
        initView()
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main)) { v, insets ->
            val systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars())
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom)
            insets
        }
    }

    private var getMessage =""
    private fun initView() {

        binding.btn1.setOnClickListener {
            getMessage = ""
            val context=binding.edit.text.toString()
            sendMessage(context, callback = {value->
                getMessage = getMessage + value
                binding.txGet.setText(getMessage)
            })
        }
    }
}